<template>
  <div class="wrapper">
    <swiper
      :options="swiperOption"
      v-if="isShowSwiper"
    >
      <!-- slides -->
      <swiper-slide
        v-for="item of list"
        :key="item.id"
      >
        <img
          class="swiper-image"
          :src="item.imgUrl"
        >
      </swiper-slide>
      <!-- Optional controls -->
      <div
        class="swiper-pagination"
        slot="pagination"
      ></div>
    </swiper>
  </div>
</template>

<script>
export default {
  name: 'HomeSwiper',
  props: {
    list: Array
  },
  data () {
    return {
      swiperOption: {
        pagination: '.swiper-pagination',
        loop: true
      },
      swiperList: [
        {
          id: '001',
          imgUrl: 'http://img1.qunarzz.com/piao/fusion/1812/d6/daa880b254940402.jpg_750x200_b114308a.jpg'
        },
        {
          id: '002',
          imgUrl: 'http://img1.qunarzz.com/piao/fusion/1901/81/f65f67c168e5f102.jpg_750x200_2ec00db3.jpg'
        },
        {
          id: '003',
          imgUrl: 'http://img1.qunarzz.com/piao/fusion/1811/31/da037478f37cf202.jpg_750x200_fe28d396.jpg'
        },
        {
          id: '004',
          imgUrl: 'http://mp-piao-admincp.qunarzz.com/mp_piao_admin_mp_piao_admin/admin/20191/647148a2b7a64d45e1b067053bf5ea82.jpg_750x200_45f23d4d.jpg'
        },
        {
          id: '005',
          imgUrl: 'http://mp-piao-admincp.qunarzz.com/mp_piao_admin_mp_piao_admin/admin/20191/780e69e0fcb1a1d29bfb70ceafc42d51.jpg_750x200_2f5256b1.jpg'
        }
      ]
    }
  },
  computed: {
    isShowSwiper () {
      return !!this.list.length
    }
  }
}
</script>

<style lang="stylus" scoped>
.wrapper >>> .swiper-pagination-bullet-active
  background #fff

.wrapper
  height 2.3438rem

.swiper-image
  width 100%
</style>
